<?php
/**
 * Model dla klasy DefaultUser
 *
 * @author ModGen
 */

class DefaultUser extends DataObject implements UserInterface{


	/**
	 * nazwa tabeli
	 */
	static $tableName = 'default_user';

	/**
	 * nazwa klucza tabeli
	 */
	static $classTablePK = 'id_default_user';

	/**
	 * nazwa klasy
	 */
	static $className = __CLASS__;

	/**
	 * tablica mapująca pola klasy
	 */
	static $fields = array(
		'id_default_user' => 'id',
		'id_mf_image_group' => 'idMfImageGroup',
		'avatar' => 'avatar',
		'email' => 'email',
		'login' => 'login',
		'login_url' => 'loginUrl',
		'description' => 'description',
		'password' => 'password',
		'hash' => 'hash',
		'active' => 'active',
		'online' => 'online',
		'saved_login_hash' => 'savedLoginHash',
		'id_role' => 'idRole',
		'id_account' => 'idAccount',
		'status' => 'status',
		'date_insert' => 'dateInsert',
		'date_update' => 'dateUpdate'
	);


	protected $id;
	private $idMfImageGroup;
	private $avatar;
	private $email;
	private $login;
	private $loginUrl;
	private $description;
	private $password;
	private $hash;
	private $active;
	private $online;
	private $savedLoginHash;
	private $idRole;
	private $idAccount;
	private $status;
	private $dateInsert;
	private $dateUpdate;


	//role
	private $roles;
	private $role;

	// -- Konstruktor --


	function __construct( $id = -1 , $idMfImageGroup = null, $avatar = null, $email = null, $login = null, $loginUrl = null, $description = null, $password = null, $hash = null, $active = null, $online = null, $savedLoginHash = null, $idRole = null, $idAccount = null, $status = null, $dateInsert = null, $dateUpdate = null){
		$this->id = $id;
		$this->idMfImageGroup = $idMfImageGroup;
		$this->avatar = $avatar;
		$this->email = $email;
		$this->login = $login;
		$this->loginUrl = $loginUrl;
		$this->description = $description;
		$this->password = $password;
		$this->hash = $hash;
		$this->active = $active;
		$this->online = $online;
		$this->savedLoginHash = $savedLoginHash;
		$this->idRole = $idRole;
		$this->idAccount = $idAccount;
		$this->status = $status;
		$this->dateInsert = $dateInsert;
		$this->dateUpdate = $dateUpdate;
	}



	// -- Get-y i Set-y --

	public function getId(){
		return $this->id;
	}

	public function setId($id){
		$this->id = $id;
	}

	
	public function getIdMfImageGroup(){
		return $this->idMfImageGroup;
	}

	public function setIdMfImageGroup($idMfImageGroup){
		$this->idMfImageGroup = $idMfImageGroup;
	}

	
	public function getAvatar(){
		return $this->avatar;
	}

	public function setAvatar($avatar){
		$this->avatar = $avatar;
	}

	
	public function getEmail(){
		return $this->email;
	}

	public function setEmail($email){
		$this->email = $email;
	}

	
	public function getLogin(){
		return $this->login;
	}

	public function setLogin($login){
		$this->login = $login;
	}

	
	public function getLoginUrl(){
		return $this->loginUrl;
	}

	public function setLoginUrl($loginUrl){
		$this->loginUrl = $loginUrl;
	}

	
	public function getDescription(){
		return $this->description;
	}

	public function setDescription($description){
		$this->description = $description;
	}

	
	public function getPassword(){
		return $this->password;
	}

	public function setPassword($password){
		$this->password = $password;
	}

	
	public function getHash(){
		return $this->hash;
	}

	public function setHash($hash){
		$this->hash = $hash;
	}

	
	public function getActive(){
		return $this->active;
	}

	public function setActive($active){
		$this->active = $active;
	}

	
	public function getOnline(){
		return $this->online;
	}

	public function setOnline($online){
		$this->online = $online;
	}

	
	public function getSavedLoginHash(){
		return $this->savedLoginHash;
	}

	public function setSavedLoginHash($savedLoginHash){
		$this->savedLoginHash = $savedLoginHash;
	}

	
	public function getIdRole(){
		return $this->idRole;
	}

	public function setIdRole($idRole){
		$this->idRole = $idRole;
	}

	
	public function getIdAccount(){
		return $this->idAccount;
	}

	public function setIdAccount($idAccount){
		$this->idAccount = $idAccount;
	}

	
	public function getStatus(){
		return $this->status;
	}

	public function setStatus($status){
		$this->status = $status;
	}

	
	public function getDateInsert(){
		return $this->dateInsert;
	}

	public function setDateInsert($dateInsert){
		$this->dateInsert = $dateInsert;
	}

	
	public function getDateUpdate(){
		return $this->dateUpdate;
	}

	public function setDateUpdate($dateUpdate){
		$this->dateUpdate = $dateUpdate;
	}

	




	/**
	* Pobiera nazwę tabeli reprezentującej obiekt w SQL
	* @return string
	*/
	public  function GetTableName(){
	return self::$tableName;
	}

	/**
	* Pobiera nazwę klucza głównego tabeli
	* @return string
	*/
	public function GetClassTablePK() {
		return self::$classTablePK;
	}

	/**
	* Pobiera tablice mapującą pola klasy na pola tabeli
	* @return array
	*/
	public  function GetFields(){
		return self::$fields;
	}

	/**
	* Pobiera nazwę klasy
	* @return string
	*/
	public  function GetClassName(){
		return self::$className;
	}



	public function hasRole($role_name=null) {
		if(!$role_name) return false;
			return in_array($role_name,explode('$',$this->roles));
	}

	public function Equalize() {
		$obj = new self::$className;
		var_dump($obj);
	}
}
?>